package com.unsins.domains.resource;

import net.sf.json.util.JSONStringer;

import com.unsins.core.domain.NamedDomain;

/**
 * 类说明
 * 
 * @author odpsoft
 * @create 2008 2008-10-30
 */
public class Dictionary extends NamedDomain {

	private static final long serialVersionUID = 7217476423468527362L;

	private String descrption;
	private boolean enabled = true;
	private Integer version;

	public String getDescrption() {
		return descrption;
	}

	public void setDescrption(String descrption) {
		this.descrption = descrption;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Dictionary)) {
			return false;
		}

		final Dictionary user = (Dictionary) o;

		return !(getId() != null ? !getId().equals(user.getId()) : user.getId() != null);

	}

	public int hashCode() {
		return getName() != null ? getName().hashCode() : 0;
	}

	public String toString() {
		JSONStringer json = new JSONStringer();

		json.object();
		json.key("name");
		json.value(getName());
		
		json.key("id");
		json.value(getId());
		
		json.key("descrption");
		json.value(getDescrption());
		
		json.key("enabled");
		json.value(isEnabled());
		json.endObject();

		return json.toString();
	}
}
